<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="chargeForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="buildingName" nzRequired>楼栋名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择楼栋名称'">
              <nz-input-group nzSearch [nzAddOnAfter]="buildingNameSuffixIconButton">
                <input nz-input formControlName="buildingName" placeholder="请选择楼栋名称" readonly />
              </nz-input-group>
              <ng-template #buildingNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findBuilding()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="roomNumber" nzRequired>单元房号</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择单元房号'">
              <nz-input-group nzSearch [nzAddOnAfter]="roomNumberSuffixIconButton">
                <input nz-input formControlName="roomNumber" placeholder="请选择单元房号" readonly />
              </nz-input-group>
              <ng-template #roomNumberSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findRoom()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="chargeType" nzRequired>收费类型</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择收费类型'">
              <nz-select formControlName="chargeType">
                <nz-option nzLabel="物业费" [nzValue]="10"></nz-option>
                <nz-option nzLabel="水费" [nzValue]="20"></nz-option>
                <nz-option nzLabel="电费" [nzValue]="30"></nz-option>
                <nz-option nzLabel="煤气费" [nzValue]="40"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="billingCycle">收费周期类型</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="billingCycle" placeholder="请输入收费周期类型" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="billingStartDate">收费周期开始时间</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="billingStartDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="billingEndDate">收费周期结束时间</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="billingEndDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="amount">金额</nz-form-label>
            <nz-form-control>
            <nz-input-number formControlName="amount" [nzMin]="1" [nzMax]="999999" />
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="lateFee">滞纳金金额</nz-form-label>
            <nz-form-control>
            <nz-input-number formControlName="lateFee" [nzMin]="1" [nzMax]="99999999" [nzPrecision]="2" [nzStep]="0.1" />
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="dueDate">应付截止日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="dueDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="paymentDate">实际支付日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="paymentDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="paymentStatus">支付状态</nz-form-label>
            <nz-form-control>
              <nz-select formControlName="paymentStatus">
                <nz-option nzLabel="未支付" [nzValue]="10"></nz-option>
                <nz-option nzLabel="已支付" [nzValue]="20"></nz-option>
                <nz-option nzLabel="已作废" [nzValue]="90"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<building-selector (buildingSelectedEvent)="handleBuildingSelectedEvent($event)"></building-selector>
<room-selector (roomSelectedEvent)="handleRoomSelectedEvent($event)"></room-selector>
